package com.java.day09.homework.test;

public class BattleGame {
    public static void main(String[] args) {
        // 创建两组玩家
        Player player1 = new Player("Alice", 100, 20);
        Player player2 = new Player("Bob", 120, 15);
        Player player3 = new Player("Charlie", 90, 25);
        Player[] team1Players = {player1, player2, player3};

        Player player4 = new Player("David", 80, 30);
        Player player5 = new Player("Eve", 110, 18);
        Player player6 = new Player("Frank", 105, 22);
        Player[] team2Players = {player4, player5, player6};

        Team team1 = new Team(team1Players);
        Team team2 = new Team(team2Players);

        // 对战开始
        while (team1.isTeamAlive() && team2.isTeamAlive()) {
            team1.attack(team2);
            team2.attack(team1);

            // 假设每轮攻击后对战暂停，以便输出当前状态或进行其他操作
            System.out.println("--- Round Ended ---");
        }

        // 宣布获胜队伍
        if (!team1.isTeamAlive()) {
            System.out.println("Team 2 wins!");
        } else {
            System.out.println("Team 1 wins!");
        }
    }
}
